//引入样式
require("../../assets/fonts/iconfont.css");
require("../../assets/css/normalize.css");
require("../../assets/css/reset.css");
require("../../assets/css/swiper-bundle.min.css");
require("../../assets/css/tabbar.less");
require("../../assets/css/sports.less");
require("../../assets/fontst/iconfont.css");
require("./sports_ride.less");

//引入模块
const dom = require("../../utils/dom");
const axios = require("../../utils/axios");

document.addEventListener("DOMContentLoaded", function () {
	//渲染tabbar
	dom.tabbar("sports");
	//渲染顶部nav
	dom.navbar("ride");
	// 点击go页面跳转
	dom.get("#go").addEventListener("click", function () {
		dom.get("#mask1").style.display = "block";
		let n = 3;
		// 倒计时
		setInterval(function () {
			n--;
			dom.get("#count").textContent = n;
			if (n === 0) {
				location.href = "sports_riding.html";
			}
		}, 1000);
	});
	// 渲染总里程
	axios.get("/api/exercise").then((res) => {
		dom.get("#num").textContent = res.data.data.sum7Meter / 1000;
	});
});
